package com.example.db.service;

import cn.hutool.core.util.IdUtil;
import com.example.db.dynamicdatasource.annotation.Master;
import com.example.db.entity.User;
import com.example.db.repository.UserRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author L.xf
 * @date 2021/10/27
 */
@Service
@AllArgsConstructor
public class BizServiceImpl implements BizService {

    private final UserRepository userRepository;

    @Override
    @Master
    public void savaAll() {
//        userRepository.deleteAll();
        User user = new User();
//        user.setId(IdUtil.getSnowflake().nextId());
        user.setName("123");
        userRepository.save(user);
    }

}
